package demo.boot.actuator;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

@SpringBootApplication
@ConfigurationPropertiesScan()
public class ActuatorApp {
    @Resource
    App app;
    @PostConstruct
    public void after() throws JsonProcessingException {
        ObjectMapper mapper = new ObjectMapper();
        System.out.printf(mapper.writeValueAsString(app));
    }

    public static void main(String[] args) {
        SpringApplication.run(ActuatorApp.class);

    }
}

@Getter
@Setter
@NoArgsConstructor
@ConfigurationProperties(prefix = "app")
class App{
    private String id;
    private Date date;
    private Map<String,String> map;
    private List<Integer> list;


}